package com.magicode.portal.service.impl;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.apache.taglibs.standard.tag.common.core.ParamParent;
import org.hibernate.mapping.Array;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.magicode.cms.common.assist.json.JsonOperation;
import com.magicode.cms.entiy.base.Article;
import com.magicode.cms.entiy.base.News;
import com.magicode.cms.entiy.base.OfflineEvents;
import com.magicode.cms.entiy.base.OfflineEventsUser;
import com.magicode.cms.entiy.base.User;
import com.magicode.common.dao.ICommonDaoService;
import com.magicode.common.dao.PageResults;
import com.magicode.portal.service.ISecListService;
import com.magicode.portal.service.ISecOffLineService;


@Service("secListService")
@Transactional
public class SecListServiceImpl implements ISecListService {
	
	@Autowired
	@Qualifier("commonDaoService")
	private ICommonDaoService commonDaoService;
	
	@Override
	public Article getArticle(String id) {
		String hql = " from com.magicode.cms.entiy.base.Article o "
				+ " left join fetch o.source "
				+ " left join fetch o.author "
				+ " left join fetch o.mainPic "
				+ " left join fetch o.channel "
				+ " left join fetch o.billBoardType "
				+ " where o.id=? ";
		Article  article= null;
		try {
			article = (Article) this.commonDaoService.getByHQL(hql, new String[]{id});
		} catch (Exception e) {
			e.printStackTrace();
		}
		return article;
	}

	@Override
	public PageResults getArticleList() {
		String hql = " from "+Article.class.getName()+" t left outer join fetch t.channel" ;
		hql+=" left outer join fetch t.mainPic ";
		hql+=" left outer join fetch t.relaPics ";
		String hql_where =" where  1=1 ";
		String hql_order =" order by t.orderCode desc , t.subcribeTime desc ";
		PageResults pageResults = commonDaoService.findPageByFetchedHql(hql+hql_where+hql_order, null, 0, 10, new String[]{});
		return pageResults;
	}

	@Override
	public Boolean createObject(Article obj) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean editObject(Article obj) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean deleteObject(String objid) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Article getObject(String objid) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Article getObject(String objid, String[] fetchJoins)
			throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object getObject(String classname, String id) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getHql(Map<String, String> querywhere) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Article> queryDataList(String hql, int start, int size) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Object> queryDataList(String hql) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Map<String, Object>> grid(Map<String, String> querywhere) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Map<String, Object>> select(Map<String, String> querywhere) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Map<String, Object>> queryMapDataList(String hql,
			Map<String, String> selectprams, int start, int size) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Long queryCount(Map<String, String> querywhere) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Integer getGridStartOrSize(Map<String, String> querywhere,
			Integer defaultval, String key) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Integer getGridPage(Map<String, String> querywhere, Long count) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean containRoleCodeByUser(String roleCode, String userId) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public PageResults getRelateProByList(String hql, String connentStr,
			String propertyName, PageResults pageResultList) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List getRelateProByList(String hql, String connentStr,
			String propertyName, List list) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<JsonOperation> getOpts(Map<String, Object> pram, String url,
			Map<String, Object> rowdata) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<JsonOperation> getOpts(String url, String id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Map<String, Object>> getBeanInfo() {
		// TODO Auto-generated method stub
		return null;
	}

	
}

